<?php

class LoginView extends dmq\View
{
	public function buildLoginForm()
	{
		$this->markup( '<form action="index.php?c=login" method="POST">' . "\r\n" );
		$this->markup( '  <fieldset>' . "\r\n" );
		$this->markup( '    <label for"login-username">Username:</label>' . "\r\n" );
		$this->markup( '    <input type="text" name="login-username" id="login-username" />' . "\r\n" );
		
		$this->markup( '    <label for"login-password">Password:</label>' . "\r\n" );
		$this->markup( '    <input type="password" name="login-password" id="login-password" />' . "\r\n" );
		
		$this->markup( '    <input type="submit" name="login-submit" id="login-submit" value="Log in" />' . "\r\n" );
		$this->markup( '  </fieldset>' . "\r\n" );
		$this->markup( '</form>' . "\r\n" );
	}

	public function triedToLogIn()
	{
		return isset( $_POST['login-submit'] ) ? $_POST['login-submit'] : null;	
	}

	public function getUsername()
	{
		return isset( $_POST['login-username'] ) ? $_POST['login-username'] : null;
	}
	
	public function getPassword()
	{
		return isset( $_POST['login-password'] ) ? $_POST['login-password'] : null;
	}
}
